package com.elong.android.specialhouse.dialogutil;


import android.content.Context;
import android.view.View;

import com.elong.android.specialhouse.R;


public class HttpTimeoutDialog extends BaseHttpDialog implements View.OnClickListener {

	public HttpTimeoutDialog(Context context) {
		super(context);
		mainView.findViewById(R.id.dialog_positive_button).setOnClickListener(this);
		mainView.findViewById(R.id.dialog_negative_button).setOnClickListener(this);

		setPositiveText("继续");
		setNegativeText("取消");
		setMessage("网络不给力");
	}

	@Override
	public void setParentView() {
		parentViewId = R.layout.dialog_normal;
	}

	@Override
	public void onClick(View v) {
		int id = v.getId();
		if (id == R.id.dialog_positive_button) {
			if (confirmlistener != null) {
				confirmlistener.onHttpContinue(request);
			}
			dismiss();
		} else if (id == R.id.dialog_negative_button) {
			if (request != null) {
				request.cancel();
			}
			dismiss();
		} else {
		}
	}

	private IHttpErrorConfirmListener confirmlistener;

	public HttpTimeoutDialog bindHttpErrorConfirmListener(IHttpErrorConfirmListener confirmlistener) {
		this.confirmlistener = confirmlistener;
		return this;
	}
}
